package com.ctgu.com;

import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.Collection;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class CommissionTest {
	private int locks, stocks, barrels;
	private String expect;
	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	
	
	
	
	public CommissionTest(int locks, int  stocks,int barrels, String expect){
		this.locks = locks;
		this.stocks = stocks;
		this.barrels =barrels;
		this.expect = expect;
	}
	
	@SuppressWarnings("rawtypes")
	@Parameters
	public static Collection getData(){
		
		return (Collection<Object[]>)
				Arrays.asList(new Object[][]{
					{-1, 15, 80, "当月销售活动已结束！"}	,
					{10, 3, 56, "佣金是：248.0"},
					{10, 80, 56, "对不起，枪托数不能为负数且厂商限制一个月只能卖出少于80个！"},
					{10, 60, 55, "佣金是：585.0"},
					{69, 79, 89, "佣金是：1400.0"},
					{59, 79, 89, "佣金是：1310.0"},
				});
		
	}
	@Test
	public void testclassify() {
		assertEquals(this.expect, Commission.classify(locks, stocks,  barrels));
	}

}
